package com.ywk.base.javaBase.ioStream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class FileInputStreamClass {

	public static void main(String[] args) {
		FileInputStream in = null;
		int b = 0;
		try {
			in = new FileInputStream("E:\\代码编程。。。。\\Java\\my app\\ew\\mydir1\\mydir2\\myfile.java");
		} catch (FileNotFoundException e) {
			System.out.println("找不到文件！！！");
			System.exit(-1);
		}
		try {
			long num = 0;
			while((b = in.read()) != -1){
				System.out.print((char) b);
				num++;
			}
			in.close();
			System.out.println();
			System.out.println("共读取了"+num+"个字符");
		} catch (IOException e1) {
			System.out.println("文件读取错误");
			System.exit(-1);
		}
	}

}
